//
//  DiscoverCell.m
//  Dear
//
//  Created by 陈俊俊 on 15/7/12.
//  Copyright (c) 2015年 陈俊俊. All rights reserved.
//

#import "DiscoverCell.h"

#define LeftMargin 10
#define topMargin 13
#define BtnSize 50
#define TableHeight 75
#define GoWidth 45
#define GoHeight 25

@implementation DiscoverCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    
   self =  [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self bulidLayout];
    }
    return self;
}

- (void)bulidLayout
{
    self.imageV = [UIButton buttonWithType:UIButtonTypeCustom];
    self.imageV.frame = CGRectMake(LeftMargin,  topMargin ,BtnSize ,BtnSize);
    self.imageV.layer.cornerRadius = 5;
    self.imageV.layer.masksToBounds = YES;
    self.imageV.backgroundColor = HexColor(@"f8517c");
    [self.imageV setImage:ImageName(@"disShoot") forState:UIControlStateNormal];
    
    self.titleLabel = [MyControl creatLabelWithFrame:CGRectMake(CGRectGetMaxX(self.imageV.frame) + LeftMargin ,topMargin,ScreenSize.width - LeftMargin*3 - BtnSize - GoWidth ,20) text:nil];
    self.titleLabel.font = FontSize(15);
    
    self.goBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    self.goBtn.frame = CGRectMake(ScreenSize.width - LeftMargin - GoWidth,(TableHeight - GoHeight) /2,GoWidth ,GoHeight);
    self.goBtn.layer.cornerRadius = 5;
    self.goBtn.layer.masksToBounds = YES;
    self.goBtn.layer.borderColor = SameColor.CGColor;
    self.goBtn.layer.borderWidth = 1;
    [self.goBtn setTitle:@"进入" forState:UIControlStateNormal];
    self.goBtn.titleLabel.font = FontSize(12);
    [self.goBtn setTitleColor:SameColor forState:UIControlStateNormal];

    
    
    self.detailLabel = [MyControl creatLabelWithFrame:CGRectMake(CGRectGetMaxX(self.imageV.frame) + LeftMargin,self.titleLabel.frame.size.height + self.titleLabel.frame.origin.y,ScreenSize.width - LeftMargin*4 - BtnSize - GoWidth,40) text:nil];
    self.detailLabel.font = FontSize(12);
    self.detailLabel.numberOfLines = 0;
    self.detailLabel.textColor = [UIColor lightGrayColor];
    UILabel *lineLabel = [MyControl creatLabelWithFrame:CGRectMake(0,TableHeight-1,ScreenSize.width,1) text:nil];
    lineLabel.backgroundColor = RGBA(231, 231, 231, 1);
    [self.contentView addSubview:self.goBtn];
    [self.contentView addSubview:self.imageV];
    [self.contentView addSubview:self.titleLabel];
    [self.contentView addSubview:self.detailLabel];
    [self.contentView addSubview:lineLabel];
}


#pragma mark - 赋值
- (void)setModel:(DiscoverModel *)model
{
    self.titleLabel.text = model.titleName;
    self.detailLabel.text = model.detailName;
    
}

@end
